-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sign manifests asynchronously #1265
Conversation
11f03e7
to
61a8af4
Compare
pulp_container/app/tasks/sign.py
Outdated
manifest_file.write(artifact.file.read()) | ||
manifest_file.flush() | ||
async with tempfile.NamedTemporaryFile(dir=".", mode="wb", delete=False) as tf: | ||
await tf.write(artifact.file.read()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await tf.write(artifact.file.read()) | |
await tf.write(await sync_to_async(artifact.file.read)()) |
This should probably not be blocking...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on your latest comment, I am reverting the suggested change:
#1285 (comment)
Can you sign this off?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to understand what i meant back then. I still think that django storages does not yet know about async. So "artifact.file.read" (which is probably a blocking call,) should not be called from an async context directly, but sync_to_async
as i suggested.
af0bd00
to
5924150
Compare
I cannot really test the changes locally because of multiple permission errors in oci_env. Is someone with a vagrant box volunteering to test the changes? Or, do we trust our CI tests? |
I can test, my vagrant box seems to be alive. |
ef0872c
to
119a70b
Compare
can you update this line https://github.com/pulp/pulp_container/pull/1265/files#diff-94c6436dad7eb9a689d63e5b6e6ceb0d18ddac41ce565c1aa91313c1be8ccfc2R35 we sign manifest lists and children manifests are signed by tag too |
37633fa
to
ddc64d3
Compare
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution! |
ddc64d3
to
4cd7531
Compare
This pull request is no longer marked for closure. |
|
||
from aiofiles import tempfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh... That name is a bit deceiving. But ok.
pulp_container/app/tasks/sign.py
Outdated
added_signatures.append(signature_pk) | ||
if tagged_manifest.media_type in MANIFEST_MEDIA_TYPES.LIST: | ||
# parse ML and sign per-arches | ||
added_signatures = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you clearing that list here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should not. Oopsie woopsie. 👀
pulp_container/app/tasks/sign.py
Outdated
manifest_file.write(artifact.file.read()) | ||
manifest_file.flush() | ||
async with tempfile.NamedTemporaryFile(dir=".", mode="wb", delete=False) as tf: | ||
await tf.write(artifact.file.read()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to understand what i meant back then. I still think that django storages does not yet know about async. So "artifact.file.read" (which is probably a blocking call,) should not be called from an async context directly, but sync_to_async
as i suggested.
4cd7531
to
46076ba
Compare
pulp_container/app/tasks/sign.py
Outdated
@@ -19,6 +20,10 @@ | |||
SIGNATURE_TYPE, | |||
) | |||
|
|||
SIGNING_TASKS_COUNTER = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we expose this to the settings so it is configurable?
I know, this PR then won't be backportable, which is ok given that we don't have now any BZs opened and if we will then backporting without the settings is always an option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, i left a suggestion to expose the setting. in that case should probably rename it because counter
is misleading.
"MAX_PARALLEL_..." |
46076ba
to
761434b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
closes #1208